/**
 * 
 */
package lv.pig.base.jpa.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

/**
 * @author chenbo
 *
 */
@SuppressWarnings("serial")
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity implements Serializable
{
    
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    protected Long id;
    
    @CreatedDate
    @Column(name = "create_time", updatable = false)
    protected Date createTime;
    
    @CreatedBy
    @Column(name = "create_by", updatable = false)
    protected Long createBy;
    
    @LastModifiedDate
    @Column(name = "update_time", insertable = false)
    protected Date updateTime;
    
    @LastModifiedBy
    @Column(name = "update_by", insertable = false)
    protected Long updateBy;
    
    /**
     * @return the createTime
     */
    public Date getCreateTime()
    {
        return createTime;
    }
    
    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime)
    {
        this.createTime = createTime;
    }
    
    /**
     * @return the createBy
     */
    public Long getCreateBy()
    {
        return createBy;
    }
    
    /**
     * @param createBy the createBy to set
     */
    public void setCreateBy(Long createBy)
    {
        this.createBy = createBy;
    }
    
    /**
     * @return the updateTime
     */
    public Date getUpdateTime()
    {
        return updateTime;
    }
    
    /**
     * @param updateTime the updateTime to set
     */
    public void setUpdateTime(Date updateTime)
    {
        this.updateTime = updateTime;
    }
    
    /**
     * @return the updateBy
     */
    public Long getUpdateBy()
    {
        return updateBy;
    }
    
    /**
     * @param updateBy the updateBy to set
     */
    public void setUpdateBy(Long updateBy)
    {
        this.updateBy = updateBy;
    }
    
    /**
     * @return 返回 id
     */
    public Long getId()
    {
        return id;
    }
    
    /**
     * @param 对id进行赋值
     */
    public void setId(Long id)
    {
        this.id = id;
    }
    
}
